﻿<!DOCTYPE html>
<html>
<head>
    <script src="/js/header.js"></script>
    <link href="/lib/ztree/ztreestyle.css" rel="stylesheet" />
    <link href="/lib/icheck/skins/all.css" rel="stylesheet" />
    <style>
        .usermenu {
            background-color: #f5f5f5;
            padding: 5px 20px;
            overflow-x: hidden;
            overflow-y: auto;
            height: 365px;
        }
    </style>
    <script type="text/javascript" src="/lib/ztree/jquery.ztree.all.js"></script>
</head>
<body style="background-color: white;">
    <section class="container-fluid" style="background-color: white;">
        <ul class="nav nav-tabs m15_t" id="myTab">
            <li data-type="0" class="active liDeposit"><a href="#aDeposit" data-toggle="tab">存款</a></li>
            <li data-type="1" class="liPayment"><a href="#aPayment" data-toggle="tab">付款</a></li>
            <li data-type="2" class="liTransfer"><a href="#aTransfer" data-toggle="tab">中转</a></li>
        </ul>
        <form class="form-horizontal m15_t" id="form" onsubmit="return false;">
            <div class="tab-content">
                <!--存款-->
                <div class="tab-pane fade in active" id="aDeposit">
                    <div class="form-group">
                        <label class="wd100 control-label"><span class="WdateFmtErr">*</span>ApiKey：</label>
                        <div class="wd350 m15_l">
                            <input class="form-control" type="text" name="depositApiKey" maxlength="40" autocomplete="off" readonly />
                        </div>
                        <input class="m20_l btn-success btnAddApiKey" type="button" value="生成存款ApiKey" id="btnAddDepositApiKey" />
                    </div>
                    <div class="form-group">
                        <label class="wd100 control-label"><span class="WdateFmtErr">*</span>SecretKey：</label>
                        <div class="wd500 m15_l">
                            <input class="form-control" type="text" name="depositSecretKey" maxlength="40" autocomplete="off" readonly />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="wd100 control-label">状态：</label>
                        <div class="wd300 m15_l">
                            <label class="m10_r">
                                <input type="radio" name="depositStatus" value="1" checked="checked" /> 启用
                            </label>
                            <label>
                                <input type="radio" name="depositStatus" value="2" /> 禁用
                            </label>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="panel-default">
                            <a class="btn btn-default m10_l aEditPushAddress" id="addDepositPush" data-title="新增" data-width="500" data-height="480"><span class="glyphicon glyphicon-plus"></span> 新增</a>
                        </div>
                        <div class="table-responsive m5_t m10_l m10_t" style="overflow-y:auto;height:310px;width:97%;">
                            <table class="table table-hover privileges menuPermissions">
                                <thead>
                                    <tr>
                                        <th class="wd150 t_c">公司名称</th>
                                        <th class="wd50 t_c">类型</th>
                                        <th class="wd150 t_c">推送接收地址</th>
                                        <th class="wd50 t_c">状态</th>
                                        <th class="wd150 t_c">描述</th>
                                        <th class="wd150 t_c">版本</th>
                                        <th class="wd50 t_c">顺序</th>
                                        <th class="wd150 t_c">操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr class="noRecord">
                                        <td colspan="5">暂无记录！</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <!--付款-->
                <div class="tab-pane fade" id="aPayment">
                    <div class="form-group">
                        <label class="wd100 control-label"><span class="WdateFmtErr">*</span>ApiKey：</label>
                        <div class="wd350 m15_l">
                            <input class="form-control" type="text" name="paymentApiKey" maxlength="40" autocomplete="off" readonly />
                        </div>
                        <input class="m20_l btn-success btnAddApiKey" type="button" value="生成付款ApiKey" id="btnAddPaymentApiKey" />
                    </div>
                    <div class="form-group">
                        <label class="wd100 control-label"><span class="WdateFmtErr">*</span>SecretKey：</label>
                        <div class="wd500 m15_l">
                            <input class="form-control" type="text" name="paymentSecretKey" maxlength="40" autocomplete="off" readonly />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="wd100 control-label">状态：</label>
                        <div class="wd350 m15_l">
                            <label class="m10_r">
                                <input type="radio" name="paymentStatus" value="1" checked="checked" /> 启用
                            </label>
                            <label>
                                <input type="radio" name="paymentStatus" value="2" /> 禁用
                            </label>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="panel-default">
                            <a class="btn btn-default m10_l aEditPushAddress" id="addPaymentPush" data-title="新增" data-width="500" data-height="480"><span class="glyphicon glyphicon-plus"></span> 新增</a>
                        </div>
                        <div class="table-responsive m5_t m10_l m10_t" style="overflow-y:auto;height:310px;width:97%;">
                            <table class="table table-hover privileges menuPermissions">
                                <thead>
                                    <tr>
                                        <th class="wd150 t_c">公司名称</th>
                                        <th class="wd50 t_c">类型</th>
                                        <th class="wd150 t_c">推送接收地址</th>
                                        <th class="wd50 t_c">状态</th>
                                        <th class="wd150 t_c">描述</th>
                                        <th class="wd150 t_c">版本</th>
                                        <th class="wd150 t_c">收款记录</th>
                                        <th class="wd50 t_c">顺序</th>
                                        <th class="wd150 t_c">操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr class="noRecord">
                                        <td colspan="5">暂无记录！</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <!--中转-->
                <div class="tab-pane fade" id="aTransfer">
                    <div class="form-group">
                        <label class="wd100 control-label"><span class="WdateFmtErr">*</span>ApiKey：</label>
                        <div class="wd350 m15_l">
                            <input class="form-control" type="text" name="transferApiKey" maxlength="40" autocomplete="off" readonly />
                        </div>
                        <input class="m20_l btn-success btnAddApiKey" type="button" value="生成中转ApiKey" id="btnAddTransferApiKey" />
                    </div>
                    <div class="form-group">
                        <label class="wd100 control-label"><span class="WdateFmtErr">*</span>SecretKey：</label>
                        <div class="wd500 m15_l">
                            <input class="form-control" type="text" name="transferSecretKey" maxlength="40" autocomplete="off" readonly />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="wd100 control-label">状态：</label>
                        <div class="wd350 m15_l">
                            <label class="m10_r">
                                <input type="radio" name="transferStatus" value="1" checked="checked" /> 启用
                            </label>
                            <label>
                                <input type="radio" name="transferStatus" value="2" /> 禁用
                            </label>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="panel-default">
                            <a class="btn btn-default m10_l aEditPushAddress" id="addTransferPush" data-title="新增" data-width="500" data-height="480"><span class="glyphicon glyphicon-plus"></span> 新增</a>
                        </div>
                        <div class="table-responsive m5_t m10_l m10_t" style="overflow-y:auto;height:310px;width:97%;">
                            <table class="table table-hover privileges menuPermissions">
                                <thead>
                                    <tr>
                                        <th class="wd150 t_c">公司名称</th>
                                        <th class="wd50 t_c">类型</th>
                                        <th class="wd150 t_c">推送接收地址</th>
                                        <th class="wd50 t_c">状态</th>
                                        <th class="wd150 t_c">描述</th>
                                        <th class="wd150 t_c">版本</th>
                                        <th class="wd150 t_c">收款记录</th>
                                        <th class="wd50 t_c">顺序</th>
                                        <th class="wd150 t_c">操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr class="noRecord">
                                        <td colspan="5">暂无记录！</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <!--隐藏域信息-->
                <input type="hidden" id="hidType" value="0" />
                <input type="hidden" id="hidDepositStatus" value="0" />
                <input type="hidden" id="hidPaymentStatus" value="0" />
                <input type="hidden" id="hidTransferStatus" value="0" />
                <!--隐藏域信息-->
            </div>
        </form>
    </section>
    <script type="text/x-dot-template" id="pushAddressTpl">
        {{? it && it.length>0}}
        {{ for(var prop in it) { }}
        <tr>
            <td class="t_c wd150">
                {{=it[prop]['companyName']}}
            </td>
            <td class="t_c wd50">{{=FlashPay.Util.GetApiPushType(it[prop]['type'])}}</td>
            <td class="t_c wd150">{{=it[prop]['url']}}</td>
            <td class="t_c wd50">{{=FlashPay.Util.GetStatusValue(it[prop]['status'])}}</td>
            <td class="t_c wd150">{{=it[prop]['description']==null?"":it[prop]['description']}}</td>

            <td class="t_c wd150 tdVersion">V{{=it[prop]['version']}}</td>
            {{? it[prop]['pushDeposit']!=0}}
            <td class="t_c wd50">{{=it[prop]['pushDeposit']=='2'?"不推送":"推送"}}</td>
            {{?}}

            <td class="t_c wd50">{{=it[prop]['sortNo']}}</td>
            <td class="t_c wd150">
                <button type="button" class="btn btn-default m5_l btnEditPushAddress" data-href="/view/company/editpushaddress.html?id={{= it[prop]['id']}}&companyID={{=it[prop]['companyId']}}"
                        data-title="编辑 - {{=it[prop]['companyName']}}" data-width="500" data-height="480">
                    <span class="glyphicon glyphicon-edit"></span> 编辑
                </button>
                <button type="button" class="btn btn-danger" data-id="{{=it[prop]['id']}}" onclick="RemoveRow(this)">
                    <span class="glyphicon glyphicon-trash"></span> 删除
                </button>
            </td>
        </tr>
        {{ } }}
        {{??}}
        <tr class="noRecord">
            <td colspan="5">暂无记录！</td>
        </tr>
        {{?}}
    </script>
    <script type="text/x-dot-template" id="noRecordTpl">
        <tr class="noRecord">
            <td colspan="4">暂无记录！</td>
        </tr>
    </script>
    <script type="text/javascript">
        var depositId, paymentId, transferId = 0;
        var permission = "";

        var setAuthorization = function () {
            var self = this;
            self.obj = {
                AddApiKey: ".btnAddApiKey",
                AddSecretKey: ".btnAddSecretKey",
                EditPushAddress: ".aEditPushAddress",
                PushAddressTpl: "#pushAddressTpl",
                HidType: "#hidType"
            }

            //跳转公共方法
            self.Common = function (modal) {
                Common(modal);
            }

            self.BindEvent = function () {

                //生成ApiKey
                $(self.obj.AddApiKey).click(function () {

                    let typeKey = $(self.obj.HidType).val();
                    let url = "";
                    if (typeKey == 0) {
                        url = "/SysConfig/GetNewKeyByDeposit";
                    } else if (typeKey == 1) {
                        url = "/SysConfig/GetNewKeyByPayment";
                    } else if (typeKey == 2) {
                        url = "/SysConfig/GetNewKeyByTransfer";
                    }

                    FlashPay.UI.Confirm({
                        content: "确定要生成新的Key吗？",
                        ok: function () {
                            FlashPay.Util.Ajax({
                                type: "get",
                                url: url,
                                data: {},
                                success: function (data) {
                                    if (data.success) {
                                        if (typeKey == 0) {
                                            FlashPay.Util.SetInputVal("depositApiKey", data.statusCode);
                                            FlashPay.Util.SetInputVal("depositSecretKey", data.successMessage);
                                        } else if (typeKey == 1) {
                                            FlashPay.Util.SetInputVal("paymentApiKey", data.statusCode);
                                            FlashPay.Util.SetInputVal("paymentSecretKey", data.successMessage);
                                        } else {
                                            FlashPay.Util.SetInputVal("transferApiKey", data.statusCode);
                                            FlashPay.Util.SetInputVal("transferSecretKey", data.successMessage);
                                        }
                                    } else {
                                        FlashPay.UI.Tip_warning("生成key失败！");
                                        return;
                                    }
                                },
                                error: function (e) {
                                    FlashPay.UI.Tip_warning("生成key错误！");
                                }
                            });
                        }
                    });
                });

                var isClick = true;
                $("#myTab li").click(function () {
                    var index = $(this).attr("data-type");
                    $(self.obj.HidType).val(index);
                    self.Init(index);
                })

                $("input[name='depositStatus']").click(function () {
                    var thisVal = $(this).val();
                    $("#hidDepositStatus").val(thisVal);
                })

                $("input[name='paymentStatus']").click(function () {
                    var thisVal = $(this).val();
                    $("#hidPaymentStatus").val(thisVal);
                })

                $("input[name='transferStatus']").click(function () {
                    var thisVal = $(this).val();
                    $("#hidTransferStatus").val(thisVal);
                })

                //新增跳转
                $(self.obj.EditPushAddress).click(function () {
                    var modal = $(this);
                    self.Common(modal);
                });
            }

            self.Init = function (typeValue) {
                doSearch(typeValue);
            }

            //编辑跳转
            self.EditRow = function () {
                $(".btnEditPushAddress").click(function () {
                    var modal = $(this);
                    self.Common(modal);
                });
            }

            self.Invoke = function () {
                self.BindEvent();
                self.Init(0);
            }
        }

        $(function () {
            new setAuthorization().Invoke();

            //提交
            self.save = function () {
                let apiKey = $("input[name='depositApiKey']").val();
                let secretKey = $("input[name='depositSecretKey']").val();

                let paymentApiKey = $("input[name='paymentApiKey']").val();
                let paymentSecretKey = $("input[name='paymentSecretKey']").val();

                let transferApiKey = $("input[name='transferApiKey']").val();
                let transferSecretKey = $("input[name='transferSecretKey']").val();

                let companyId = FlashPay.Util.GetQueryString("id");
                var dataArr = [];
                let clickType = $("#hidType").val();

                if (permission.canDeposit) {
                    if (clickType == 0) {
                        if (FlashPay.Util.isNullOrEmptySpance(apiKey) || FlashPay.Util.isNullOrEmptySpance(secretKey)) {
                            FlashPay.UI.Tip_warning("请点击生成存款ApiKey和SecretKey！");
                            return;
                        }
                    }
                }

                if (permission.canPayment) {
                    if (clickType == 1) {
                        if (FlashPay.Util.isNullOrEmptySpance(paymentApiKey) || FlashPay.Util.isNullOrEmptySpance(paymentSecretKey)) {
                            FlashPay.UI.Tip_warning("请点击生成付款ApiKey和SecretKey！");
                            return;
                        }
                    }
                }

                if (permission.canTransfer) {
                    if (clickType == 2) {
                        if (FlashPay.Util.isNullOrEmptySpance(transferApiKey) || FlashPay.Util.isNullOrEmptySpance(transferSecretKey)) {
                            FlashPay.UI.Tip_warning("请点击生成中转ApiKey和SecretKey！");
                            return;
                        }
                    }
                }

                if (!FlashPay.Util.isNullOrEmptySpance(apiKey) && !FlashPay.Util.isNullOrEmptySpance(secretKey)) {
                    let dataModel = {};
                    dataModel.ApiKey = apiKey;
                    dataModel.SecretKey = secretKey;
                    dataModel.Status = $("input[name='depositStatus']:checked").val();
                    dataModel.CompanyId = companyId;
                    if (depositId > 0) {
                        dataModel.Id = depositId;
                    }
                    dataModel.Type = 1;
                    dataArr.push(dataModel);
                }

                if (!FlashPay.Util.isNullOrEmptySpance(paymentApiKey) && !FlashPay.Util.isNullOrEmptySpance(paymentSecretKey)) {
                    var dataModel2 = {};
                    dataModel2.ApiKey = paymentApiKey;
                    dataModel2.SecretKey = paymentSecretKey;
                    dataModel2.Status = $("input[name='paymentStatus']:checked").val();
                    dataModel2.CompanyId = companyId;
                    dataModel2.Type = 2;
                    if (paymentId > 0) {
                        dataModel2.Id = paymentId;
                    }
                    dataArr.push(dataModel2);
                }

                if (!FlashPay.Util.isNullOrEmptySpance(transferApiKey) && !FlashPay.Util.isNullOrEmptySpance(transferSecretKey)) {
                    var dataModel3 = {};
                    dataModel3.ApiKey = transferApiKey;
                    dataModel3.SecretKey = transferSecretKey;
                    dataModel3.Status = $("input[name='transferStatus']:checked").val();
                    dataModel3.CompanyId = companyId;
                    dataModel3.Type = 4;
                    if (transferId > 0) {
                        dataModel3.Id = transferId;
                    }
                    dataArr.push(dataModel3);
                }

                FlashPay.Util.Ajax({
                    type: "POST",
                    url: "/Company/ExtApiCompatEditNew/",
                    data: { arrStr: JSON.stringify(dataArr) },
                    success: function (data) {
                        if (data.success) {
                            FlashPay.UI.Tip_success(data.successMessage == null ? "操作成功！" : data.successMessage);
                            setTimeout(function () {
                                FlashPay.UI.CloseDialog();
                            }, 1000);
                        } else {
                            FlashPay.UI.Tip_short_warning(data.errorMessage == null ? "操作失败！" : data.errorMessage);
                        }
                        return;
                    },
                    error: function (e) {
                        FlashPay.UI.Tip_warning("保存失败！");
                    }
                });
            }

            //删除
            self.RemoveRow = function (obj) {
                FlashPay.UI.Confirm({
                    content: "确定要删除吗？",
                    ok: function () {
                        let dataModel = {};
                        let did = $(obj).attr("data-id");
                        dataModel.ID = did;
                        dataModel.Status = 3;
                        FlashPay.Util.Ajax({
                            type: "POST",
                            url: "/Company/ExtApiPushUrlDel/",
                            data: dataModel,
                            success: function (data) {
                                if (data.success) {
                                    var length = $("table.menuPermissions > tbody > tr").length;
                                    $(obj).parent().parent().remove();
                                    if (length == 1) {
                                        var noRecordText = doT.template($("#noRecordTpl").text());
                                        $("table.menuPermissions tbody").append(noRecordText());
                                    }
                                } else {
                                    FlashPay.UI.Tip_short_warning(data.errorMessage == null ? "删除失败！" : data.errorMessage);
                                }
                                return;
                            },
                            error: function (e) {
                                FlashPay.UI.Tip_warning("操作失败！");
                            }
                        });
                    }
                });
            }
        })

        //为了修改后可以刷新
        function doSearch(typeValue = 0) {
            var cover = FlashPay.UI.Mask({
                obj: $("body"),
                opacity: 0.5
            });
            var cid = FlashPay.Util.GetQueryString("id");

            var datas = { companyId: cid };
            FlashPay.Util.Ajax({
                type: "Get",
                url: "/Company/GeteExtApi/",
                dataType: "json",
                contentType: "application/json",
                data: datas,
                success: function (response) {
                    if (response.success) {

                        let dataItem = [];
                        let resData = response.data;

                        //验证权限======================================================================================
                        permission = response.permissionData;

                        //没有存款查看权限
                        if (!permission.canDeposit) {
                            //$(".liDeposit").remove(); $("#aDeposit").remove();
                            $(".liDeposit").hide(); $("#aDeposit").hide();
                        } else {
                            if (typeValue == 0) { //存款
                                $("#addDepositPush").attr("data-href", "/view/company/editpushaddress.html?type=1&version=" + resData.depositVersion + "&companyID=" + cid + "");
                                let resDepositData = resData.deposit;
                                dataItem = resData.depositExtApiPushUrlResponse;
                                if (resDepositData != null) {
                                    depositId = resDepositData.id;
                                    FlashPay.Util.SetInputVal("depositApiKey", resDepositData.apiKey);
                                    FlashPay.Util.SetInputVal("depositSecretKey", resDepositData.secretKey);
                                    ShowStatus("hidDepositStatus", "depositStatus", resDepositData.status);
                                }

                                $(".liDeposit").show().addClass("active");
                                $("#aDeposit").show().removeClass("fade");

                                if (!permission.canDepositAdd) {
                                    $("#btnAddDepositApiKey").remove();
                                }

                                //删掉付款
                                if (permission.canPayment) {
                                    $(".liPayment").removeClass("active");
                                    $("#aPayment").hide();
                                }
                                //删掉中转
                                if (permission.canTransfer) {
                                    $(".liTransfer").removeClass("active");
                                    $("#aTransfer").hide();
                                }
                            }
                        }

                        //没有付款查看权限
                        if (!permission.canPayment) {
                            //$(".liPayment").remove(); $("#aPayment").remove();
                            $(".liPayment").hide(); $("#aPayment").hide();
                        } else {
                            if (typeValue == 1 || !permission.canDeposit) { //付款
                                $("#addPaymentPush").attr("data-href", "/view/company/editpushaddress.html?type=3&version=" + resData.paymentVersion + "&companyID=" + cid + "");
                                let resPaymentData = resData.payment;
                                dataItem = resData.paymentExtApiPushUrlResponse;
                                if (resPaymentData != null) {
                                    paymentId = resPaymentData.id;
                                    FlashPay.Util.SetInputVal("paymentApiKey", resPaymentData.apiKey);
                                    FlashPay.Util.SetInputVal("paymentSecretKey", resPaymentData.secretKey);
                                    ShowStatus("hidPaymentStatus", "paymentStatus", resPaymentData.status);
                                }

                                $(".liPayment").show().addClass("active");
                                $("#aPayment").show().removeClass("fade")

                                if (!permission.canPaymentAdd) {
                                    $("#btnAddPaymentApiKey").remove();
                                }

                                //删掉存款
                                if (permission.canDeposit) {
                                    $(".liDeposit").removeClass("active");
                                    $("#aDeposit").hide();
                                }
                                //删掉中转
                                if (permission.canTransfer) {
                                    $(".liTransfer").removeClass("active");
                                    $("#aTransfer").hide();
                                }
                            }
                        }

                        //没有中转查看权限
                        if (!permission.canTransfer) {
                            //$(".liTransfer").remove(); $("#aTransfer").remove();
                            $(".liTransfer").hide(); $("#aTransfer").hide();
                        } else {
                            if (typeValue == 2 || (!permission.canDeposit && !permission.canPayment)) { //中转
                                
                                $("#addTransferPush").attr("data-href", "/view/company/editpushaddress.html?type=5&version=" + resData.transferVersion + "&companyID=" + cid + "");
                                let resTransferData = resData.transfer;
                                dataItem = resData.transferExtApiPushUrlResponse;
                                if (resTransferData != null) {
                                    transferId = resTransferData.id;
                                    FlashPay.Util.SetInputVal("transferApiKey", resTransferData.apiKey);
                                    FlashPay.Util.SetInputVal("transferSecretKey", resTransferData.secretKey);
                                    ShowStatus("hidTransferStatus", "transferStatus", resTransferData.status);
                                }
                                
                                $(".liTransfer").show().addClass("active");
                                $("#aTransfer").show().removeClass("fade")

                                if (!permission.canTransferAdd) {
                                    $("#btnAddTransferApiKey").remove();
                                }

                                //删掉存款
                                if (permission.canDeposit) {
                                    $(".liDeposit").removeClass("active");
                                    $("#aDeposit").hide();
                                }
                                //删掉付款
                                if (permission.canPayment) {
                                    $(".liPayment").removeClass("active");
                                    $("#aPayment").hide();
                                }
                            }
                        }
                        //验证权限end===================================================================================
                        cover.Remove();

                        var itemText = doT.template($("#pushAddressTpl").text());
                        $("table tbody").html(itemText(dataItem));

                        $(".btnEditPushAddress").click(function () {
                            var modal = $(this);
                            Common(modal);
                        });

                    } else {
                        cover.Remove();
                    }
                },
                error: function (e) {
                    cover.Remove();
                }
            });
        }

        //显示正确的状态
        function ShowStatus(hidStatus,iptStatus,resDataStatus) {
            let hStatus = $("#" + hidStatus).val();
            if (hStatus == 0) {
                $("input[name='" + iptStatus+"']").get(resDataStatus - 1).checked = true;
            } else {
                $("input[name='" + iptStatus +"']").get(hStatus - 1).checked = true;
            }
        }

        //跳转公共方法
        function Common(modal) {
            FlashPay.UI.DialogOpen(modal.data("href"), {
                title: modal.data("title"),
                width: modal.data("width"),
                height: modal.data("height"),
                init: function () {
                    this.button(
                        {
                            name: '提交',
                            callback: function () {
                                var iframe = this.iframe.contentWindow;
                                if (!iframe.document.body) {
                                    return false;
                                }
                                iframe.save();
                                return false;
                            },
                            focus: true
                        }
                    );
                },
            });
        }
    </script>
</body>
</html>